#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QSerialPort>
#include <QSerialPortInfo>
#include <QThread>
#include <QDebug>

#include "myserialport.h"
#include "baseserialport.h"

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

    // 添加私有的槽函数
private slots:
    void on_key_on_clicked();
    void on_key_off_clicked();

    void on_Send_Key_clicked();

    // void on_OpenFile_clicked();

    void on_OpenFileButton_clicked();

public slots:
    void receiveMsg(QByteArray msg);
    void trigLight(bool isOpen);
signals:
    void open(const QString &portName,
            QSerialPort::BaudRate baudRate,
            QSerialPort::DataBits dataBits,
            QSerialPort::Parity parity,
            QSerialPort::StopBits stopBits);
    void close();
    void send(QByteArray data);

private:
    Ui::MainWindow *ui;

    QThread serialThread;
    BaseSerialport serialPort;

};

#endif // MAINWINDOW_H
